package com.company.nuwa.common.enumration;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * <p>description</p >
 *
 * @author Mitchell
 * @version 1.0
 * @date 2020/07/23 16:37
 */
@AllArgsConstructor
public enum Platform {

    /**
     * IOS
     */
    IOS("ios", "iPhone"),

    /**
     * console
     */
    CONSOLE("console", "后台"),

    /**
     * ANDROID
     */
    ANDROID("android", "安卓"),

    /**
     * H5
     */
    H5("h5", "h5"),

    /**
     * WEB
     */
    WEB("web", "web站点"),

    /**
     * obs推流端
     */
    WINDOW("window", "obs推流端"),

    /**
     * CRAWLER
     */
    CRAWLER("crawler", "爬虫"),

    /**
     * UNKNOWN
     */
    UNKNOWN("UNKNOWN", "UNKNOWN"),
    /**
     * 业务方SERVER
     */
    SERVER("SERVER", "业务方SERVER端"),
    ;

    @Getter
    private String code;
    @Getter
    private String name;

    public static Platform valueOfCode(String code) {
        Platform[] values = Platform.values();
        for (Platform value : values) {
            if (StringUtils.equals(value.getCode(), code)) {
                return value;
            }
        }
        return UNKNOWN;
    }

}
